package com.littrabble.proxy;

import java.lang.reflect.Proxy;

import org.apache.log4j.Logger;

public class ProxyDemo {
	
    private static final Logger logger = Logger.getLogger(ProxyDemo.class);
    
	public static void main(String[] args) {
		
		HelloSpeaker speaker = new HelloSpeaker();
		
		LogHandler handler = new LogHandler();
		handler.setDelegate(speaker);
		
		IHello proxy = (IHello) Proxy.newProxyInstance(speaker.getClass().getClassLoader(),speaker.getClass().getInterfaces(),handler);
		
		proxy.hello("Justin");
	}
}
